package com.xunshibao.core.dao;

import java.util.Map;

public class TransactionItem {
	public static final int ENTITY = 1;
	public static final int EHQL = 2;
	
	/**
	 * 事务类型
	 */
	private int type;
	
	/**
	 * 要保存的实体对象
	 */
	private Object entity;
	
	/**
	 * 数据库更新语句
	 */
	private ExecuteHql hql;

	public int getType() {
    	return type;
    }

	public void setType(int type) {
    	this.type = type;
    }

	public Object getEntity() {
    	return entity;
    }

	public void setEntity(Object entity) {
    	this.entity = entity;
    }

	public ExecuteHql getHql() {
    	return hql;
    }

	public void setHql(ExecuteHql hql) {
    	this.hql = hql;
    }

	public TransactionItem(Object entity) {
		super();
		this.type = TransactionItem.ENTITY;
		this.entity = entity;
	}

	public TransactionItem(ExecuteHql hql) {
		super();
		this.type = TransactionItem.EHQL;
		this.hql = hql;
	}
	
	public TransactionItem(String hql ,Map<String, Object> params) {
		super();
		this.type = TransactionItem.EHQL;
		this.hql = new ExecuteHql(hql, params);
	}
	
}
